package cn.dnui_lxx432.dnuifood_16110100432.model;

import java.util.List;

import cn.dnui_lxx432.dnuifood_16110100432.JavaBean.FoodBean;
import cn.dnui_lxx432.dnuifood_16110100432.iface.FoodIface;
import cn.dnui_lxx432.dnuifood_16110100432.listener.OnRetrofitListener;
import cn.dnui_lxx432.dnuifood_16110100432.service.ShopService;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;


public class FoodModel extends RetrofitBaseModel implements FoodIface{
    private ShopService service;
    public FoodModel(){
        super();
        service = retrofit.create(ShopService.class);
    }
    @Override
    public void getFoodByShop(String shop_id, OnRetrofitListener listener) {
        Call call = service.getFoodByShop(shop_id);
        bindCallback(call,listener,3);
    }

    @Override
    public void getFoodById(String food_id, OnRetrofitListener listener) {
        Call call = service.getFoodById(food_id);
        bindCallback(call,listener,4);
    }

    @Override
    public void getFoodBySearch(String search, OnRetrofitListener listener) {
        Call call = service.getFoodBySearch(search);
        bindCallback(call,listener,5);
    }

    public void getAllCommentsByFood(String food_id,OnRetrofitListener listener){
        Call call = service.getAllCommentsByFood(food_id);
        bindCallback(call,listener,6);


    }

    public void insertComment(String item_id, String content, final OnRetrofitListener listener){
        Call call = service.insertComment(item_id,content);
        bindCallback(call,listener,7);

    }


    public void insertOrder(String user_id, String food_id, String num, String sum, String suggesttime, String address,final OnRetrofitListener listener){
        Call call = service.insertOrder(user_id,food_id,num,sum,suggesttime,address);
        bindCallback(call,listener,8);
    }
}